/**
 * Created by Administrator on 14-7-22.
 */
$(function(){
    $(".DelNum").off().on("click",function(){

        var datagid=$(this).parent().find("input").attr("data-gid");
        changenum(datagid,-1);
    });
    $(".AddNum").off().on("click",function(){
        var datagid=$(this).parent().find("input").attr("data-gid");
        changenum(datagid,1);
    });
    $(".goods-num").off().on("change",function(){
        var datagid=$(this).attr("data-gid");
        change_goods_number(datagid,$(this).val());
    })
    $(".goods-del").off().on("click",function(){
        if (confirm('您确实要把该商品移出购物车吗？')) {
           window.location.href='flow.php?step=drop_goods&id='+$(this).attr("data-rid");
		   return false; 
        };
    })
    var $productList = $('.fitting-list-box');

    $productList.on({
        'mouseenter': function() {
            $(this).find(".item-buy").show();
        },
        'mouseleave': function() {
            $(this).find(".item-buy").hide();
        }
    }, 'li');
    $productList.off("click").on('click', '.goodsinfo', function(e) {
        var $this = $(this);
			var infos = new Object();
			infos.goods_id = $(this).attr("data-gid");
			infos.cid      = 0;
			infos.thumb    = $this.parent().find(".fitting-img img").attr("src");
			infos.number   = 1;
			infos.spec     = null;
			infos.plans    = null;
			infos.effect   = 5;
			infos.types    = 1;
			addToCart(infos);
			if ($this.hasClass('disable')) {
				return false;
			}
			$this.addClass('disable');
    });
})


